import 'package:flutter_admin/utils/utils.dart';

class SalePigtailProductPlan {

  String? id;
  String? orderNumber;
  String? clientele;
  String? province;
  String? economy;
  String? city;
  String? consignee;
  String? productName;
  String? pattern;
  String? unit;
  String? quantity;
  String? unitPrice;
  String? cableDiameter;
  String? unitCoreNumber;
  String? coreNumber;
  String? connector1;
  String? connector2;
  String? meters;
  String? totalCoreNumber;
  String? totalRows;
  String? teamMoved0;
  String? remark;
  String? logisticsDowntime;
  String? boxDemandTime;
  String? createUid;
  String? createDate;
  String? writeUid;
  String? writeDate;
  String? warehousingTime;
  String? team;
  String? productSpec;
  String? workshopName;
  String? workshop;
  String? productId;
  String? condition;
  String? marginQuantity;

  SalePigtailProductPlan({
    this.id,
    this.orderNumber,
    this.clientele,
    this.province,
    this.economy,
    this.city,
    this.consignee,
    this.productName,
    this.pattern,
    this.unit,
    this.quantity,
    this.unitPrice,
    this.cableDiameter,
    this.unitCoreNumber,
    this.coreNumber,
    this.connector1,
    this.connector2,
    this.meters,
    this.totalCoreNumber,
    this.totalRows,
    this.teamMoved0,
    this.remark,
    this.logisticsDowntime,
    this.boxDemandTime,
    this.createUid,
    this.createDate,
    this.writeUid,
    this.writeDate,
    this.warehousingTime,
    this.team,
    this.productSpec,
    this.workshopName,
    this.workshop,
    this.productId,
    this.condition,
    this.marginQuantity,
  });

  SalePigtailProductPlan copyWith({
    String? id,
    String? orderNumber,
    String? clientele,
    String? province,
    String? economy,
    String? city,
    String? consignee,
    String? productName,
    String? pattern,
    String? unit,
    String? quantity,
    String? unitPrice,
    String? cableDiameter,
    String? unitCoreNumber,
    String? coreNumber,
    String? connector1,
    String? connector2,
    String? meters,
    String? totalCoreNumber,
    String? totalRows,
    String? teamMoved0,
    String? remark,
    String? logisticsDowntime,
    String? boxDemandTime,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
    String? warehousingTime,
    String? team,
    String? productSpec,
    String? workshopName,
    String? workshop,
    String? productId,
  }) {
    return new SalePigtailProductPlan(
      id: id ?? this.id,
      orderNumber: orderNumber ?? this.orderNumber,
      clientele: clientele ?? this.clientele,
      province: province ?? this.province,
      economy: economy ?? this.economy,
      city: city ?? this.city,
      consignee: consignee ?? this.consignee,
      productName: productName ?? this.productName,
      pattern: pattern ?? this.pattern,
      unit: unit ?? this.unit,
      quantity: quantity ?? this.quantity,
      unitPrice: unitPrice ?? this.unitPrice,
      cableDiameter: cableDiameter ?? this.cableDiameter,
      unitCoreNumber: unitCoreNumber ?? this.unitCoreNumber,
      coreNumber: coreNumber ?? this.coreNumber,
      connector1: connector1 ?? this.connector1,
      connector2: connector2 ?? this.connector2,
      meters: meters ?? this.meters,
      totalCoreNumber: totalCoreNumber ?? this.totalCoreNumber,
      totalRows: totalRows ?? this.totalRows,
      teamMoved0: teamMoved0 ?? this.teamMoved0,
      remark: remark ?? this.remark,
      logisticsDowntime: logisticsDowntime ?? this.logisticsDowntime,
      boxDemandTime: boxDemandTime ?? this.boxDemandTime,
      createUid: createUid ?? this.createUid,
      createDate: createDate ?? this.createDate,
      writeUid: writeUid ?? this.writeUid,
      writeDate: writeDate ?? this.writeDate,
      warehousingTime: warehousingTime ?? this.warehousingTime,
      team: team ?? this.team,
      productSpec: productSpec ?? this.productSpec,
      workshopName: workshopName ?? this.workshopName,
      workshop: workshop ?? this.workshop,
      productId: productId ?? this.productId,
    );
  }

  @override
  String toString() {
    return '''SalePigtailProductPlan{
      id: id,
      orderNumber: orderNumber,
      clientele: clientele,
      province: province,
      economy: economy,
      city: city,
      consignee: consignee,
      productName: productName,
      pattern: pattern,
      unit: unit,
      quantity: quantity,
      unitPrice: unitPrice,
      cableDiameter: cableDiameter,
      unitCoreNumber: unitCoreNumber,
      coreNumber: coreNumber,
      connector1: connector1,
      connector2: connector2,
      meters: meters,
      totalCoreNumber: totalCoreNumber,
      totalRows: totalRows,
      teamMoved0: teamMoved0,
      remark: remark,
      logisticsDowntime: logisticsDowntime,
      boxDemandTime: boxDemandTime,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
      warehousingTime: warehousingTime,
      team: team,
      productSpec: productSpec,
      workshopName: workshopName,
      workshop: workshop,
      productId: productId,
    }''';
  }

  @override
  bool operator ==(Object other) => identical(this, other) || (
      other is SalePigtailProductPlan &&
          runtimeType == other.runtimeType
          && id== other.id
          && orderNumber== other.orderNumber
          && clientele== other.clientele
          && province== other.province
          && economy== other.economy
          && city== other.city
          && consignee== other.consignee
          && productName== other.productName
          && pattern== other.pattern
          && unit== other.unit
          && quantity== other.quantity
          && unitPrice== other.unitPrice
          && cableDiameter== other.cableDiameter
          && unitCoreNumber== other.unitCoreNumber
          && coreNumber== other.coreNumber
          && connector1== other.connector1
          && connector2== other.connector2
          && meters== other.meters
          && totalCoreNumber== other.totalCoreNumber
          && totalRows== other.totalRows
          && teamMoved0== other.teamMoved0
          && remark== other.remark
          && logisticsDowntime== other.logisticsDowntime
          && boxDemandTime== other.boxDemandTime
          && createUid== other.createUid
          && createDate== other.createDate
          && writeUid== other.writeUid
          && writeDate== other.writeDate
          && warehousingTime== other.warehousingTime
          && team== other.team
          && productSpec== other.productSpec
          && workshopName== other.workshopName
          && workshop== other.workshop
          && productId== other.productId
   );


  factory SalePigtailProductPlan.fromMap(Map<String, dynamic> map) {
    return new SalePigtailProductPlan(
      id: map['id']!=false?map['id'].toString() as String?:"",
      orderNumber: map['order_number']!=false?map['order_number'].toString() as String?:"",
      clientele: map['clientele']!=false?map['clientele'].toString() as String?:"",
      province: map['province']!=false?map['province'].toString() as String?:"",
      economy: map['economy']!=false?map['economy'].toString() as String?:"",
      city: map['city']!=false?map['city'].toString() as String?:"",
      consignee: map['consignee']!=false?map['consignee'].toString() as String?:"",
      productName: map['product_name']!=false?map['product_name'].toString() as String?:"",
      pattern: map['pattern']!=false?map['pattern'].toString() as String?:"",
      unit: map['unit']!=false?map['unit'].toString() as String?:"",
      quantity: map['quantity']!=false?map['quantity'].toString() as String?:"",
      unitPrice: map['unit_price']!=false?map['unit_price'].toString() as String?:"",
      cableDiameter: map['cable_diameter']!=false?map['cable_diameter'].toString() as String?:"",
      unitCoreNumber: map['unit_core_number']!=false?map['unit_core_number'].toString() as String?:"",
      coreNumber: map['core_number']!=false?map['core_number'].toString() as String?:"",
      connector1: map['connector1']!=false?map['connector1'].toString() as String?:"",
      connector2: map['connector2']!=false?map['connector2'].toString() as String?:"",
      meters: map['meters']!=false?map['meters'].toString() as String?:"",
      totalCoreNumber: map['total_core_number']!=false?map['total_core_number'].toString() as String?:"",
      totalRows: map['total_rows']!=false?map['total_rows'].toString() as String?:"",
      teamMoved0: map['team_moved0']!=false?map['team_moved0'].toString() as String?:"",
      remark: map['remark']!=false?map['remark'].toString() as String?:"",
      logisticsDowntime: map['logistics_downtime']!=false?map['logistics_downtime'].toString() as String?:"",
      boxDemandTime: map['box_demand_time']!=false?map['box_demand_time'].toString() as String?:"",
      createUid: map['create_uid']!=false?map['create_uid'].toString() as String?:"",
      createDate: map['create_date']!=false?map['create_date'].toString() as String?:"",
      writeUid: map['write_uid']!=false?map['write_uid'].toString() as String?:"",
      writeDate: map['write_date']!=false?map['write_date'].toString() as String?:"",
      warehousingTime: map['warehousing_time']!=false?map['warehousing_time'].toString() as String?:"",
      team: map['team']!=false?map['team'].toString() as String?:"",
      productSpec: map['product_spec']!=false?map['product_spec'].toString() as String?:"",
      workshopName: map['workshop_name']!=false?map['workshop_name'].toString() as String?:"",
      workshop: map['workshop']!=false?map['workshop'].toString() as String?:"",
      productId: map['product_id']!=false?map['product_id'].toString() as String?:"",
      condition: map['condition']!=false?map['condition'].toString() as String?:"",
      marginQuantity: map['margin_quantity']!=false?map['margin_quantity'].toString() as String?:"",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'orderNumber': this.orderNumber,
      'clientele': this.clientele,
      'province': this.province,
      'economy': this.economy,
      'city': this.city,
      'consignee': this.consignee,
      'productName': this.productName,
      'pattern': this.pattern,
      'unit': this.unit,
      'quantity': this.quantity,
      'unitPrice': this.unitPrice,
      'cableDiameter': this.cableDiameter,
      'unitCoreNumber': this.unitCoreNumber,
      'coreNumber': this.coreNumber,
      'connector1': this.connector1,
      'connector2': this.connector2,
      'meters': this.meters,
      'totalCoreNumber': this.totalCoreNumber,
      'totalRows': this.totalRows,
      'teamMoved0': this.teamMoved0,
      'remark': this.remark,
      'logisticsDowntime': this.logisticsDowntime,
      'boxDemandTime': this.boxDemandTime,
      'createUid': this.createUid,
      'createDate': this.createDate,
      'writeUid': this.writeUid,
      'writeDate': this.writeDate,
      'warehousingTime': this.warehousingTime,
      'team': this.team,
      'productSpec': this.productSpec,
      'workshopName': this.workshopName,
      'workshop': this.workshop,
      'productId': this.productId,
    } as Map<String, dynamic>;
  }

  List toDomainList({String? processId}) {
    List list = [
      if (processId != null && processId != '')
        ['&process', '=', int.parse(processId)],
      if (this.warehousingTime != null && this.warehousingTime != '')
        ['warehousing_time', '=', this.warehousingTime],
      if (this.pattern != null && this.pattern != '')
        ['pattern', 'like', "%${this.pattern}%"],
      if (this.team != null && this.team != '')
        ('|'),
        ['team', '=', int.parse(this.team!)],
        ['team', '=', null],
    ];
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'id': this.id,
      'order_number': this.orderNumber,
      'clientele': this.clientele,
      'province': this.province,
      'economy': this.economy,
      'city': this.city,
      'consignee': this.consignee,
      'product_name': this.productName,
      'pattern': this.pattern,
      'unit': this.unit,
      'quantity': this.quantity,
      'unit_price': this.unitPrice,
      'cable_diameter': this.cableDiameter,
      'unit_core_number': this.unitCoreNumber,
      'core_number': this.coreNumber,
      'connector1': this.connector1,
      'connector2': this.connector2,
      'meters': this.meters,
      'total_core_number': this.totalCoreNumber,
      'total_rows': this.totalRows,
      'team_moved0': this.teamMoved0,
      'remark': this.remark,
      'logistics_downtime': this.logisticsDowntime,
      'box_demand_time': this.boxDemandTime,
      'create_uid': this.createUid,
      'create_date': this.createDate,
      'write_uid': this.writeUid,
      'write_date': this.writeDate,
      'warehousing_time': this.warehousingTime,
      'team': this.team,
      'product_spec': this.productSpec,
      'workshop_name': this.workshopName,
      'workshop': this.workshop,
      'product_id': this.productId,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}